home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 - Homepage / CHIP.BIN / share / htmledit / bashhtml / bashhtml.exe / %AppDir% / scripts / Close Browser Window.txt < prev    next >
Encoding:
Text File  |  2003-09-01  |  915 b   |  41 lines

  1. [DESCRIPTION]Displays a message box with Yes/No buttons.[/DESCRIPTION]
  2.  
  3. [HEAD CODE][/HEAD CODE]
  4.  
  5. [BODY CODE]<SCRIPT language="JavaScript">
  6. <!--
  7. {
  8.  var where_to= confirm("Are you sure?");
  9.  if (where_to== true)
  10.  {
  11.    window.location="http://www.bashsoftware.tk";
  12.  }
  13.  else
  14.  {
  15.   // do nothing
  16.   }
  17. }
  18. //-->
  19. </SCRIPT>[/BODY CODE]
  20.  
  21.  
  22. [NOTES]Just place the code in the Body of your page and it will show when the page is loaded. If you want to show a message box when the user clicks a link or a button, make the script a named function then use the OnClick event as shown below:
  23.  
  24. <SCRIPT language="JavaScript">
  25. <!--
  26. function confirm_it()
  27. {
  28.  var where_to= confirm("Are you sure?");
  29.  if (where_to== true)
  30.  {
  31.    window.location="http://www.bashsoftware.tk";
  32.  }
  33.  else
  34.  {
  35.   // do nothing
  36.   }
  37. }
  38. //-->
  39. </SCRIPT>
  40.  
  41. <INPUT TYPE="button" value="Show Confirmation" onClick="confirm_it()">[/NOTES]